Tags: #◇Computer Science #◇CCDSALG #◇Data Structures #◇Algorithms #◇Reviewer #◇Finals
CCDSALG Comprehensive Finals Reviewer
◇Overview
This reviewer synthesizes Data Structures and Algorithms (CCDSALG). It encompasses asymptotic complexity analysis (), linear data structures (arrays, singly/doubly linked lists, stacks, queues), nonlinear structures (trees, binary search trees, self-balancing AVL trees, binary min/max heaps), hash tables with collision resolution strategies, and graph theory algorithms (BFS, DFS, Dijkstra, Prim, Kruskal).
◇1. Master Asymptotic Complexity Matrix
| Data Structure / Algorithm | Access / Search | Insertion | Deletion | Space Complexity |
|---|---|---|---|---|
| Array (Dynamic) | / | (amortized at end) | ||
| Singly Linked List | (at head) | (if node given, else ) | ||
| Stack / Queue | (push / enqueue) | (pop / dequeue) | ||
| Hash Table | avg / worst | avg / worst | avg / worst | |
| Binary Search Tree | worst | worst | worst | |
| AVL Tree | guaranteed | guaranteed | guaranteed | |
| Binary Heap | peek min/max | extract min/max |
Sorting Algorithms Comparison
| Algorithm | Best Time | Average Time | Worst Time | Space | Stable? |
|---|---|---|---|---|---|
| Bubble / Insertion Sort | Yes | ||||
| Merge Sort | Yes | ||||
| Quick Sort | No | ||||
| Heap Sort | No |
◇2. AVL Tree Balance Factor & Rotations
The balance factor of a node is defined as:
- LL Imbalance Single Right Rotation on .
- RR Imbalance Single Left Rotation on .
- LR Imbalance Double Rotation: Left Rotate on child , then Right Rotate on .
- RL Imbalance Double Rotation: Right Rotate on child , then Left Rotate on .
◇3. Graph Algorithms Comparison
- Breadth-First Search (BFS): Uses a Queue. Computes unweighted shortest paths in .
- Depth-First Search (DFS): Uses a Stack (or recursion). Detects cycles, topological sorting, and strongly connected components in .
- Dijkstra's Algorithm: Greedy algorithm using a Min-Priority Queue. Computes single-source shortest path for non-negative weights in .
- Kruskal's Algorithm: Greedy MST algorithm. Sorts edges and applies Disjoint Set Union (DSU / Union-Find) with union-by-rank and path compression in .
- Prim's Algorithm: Greedy MST algorithm growing a single tree using a min-heap in .
◇4. High-Yield Exam Checklist
- Does QuickSort worst-case occur on already-sorted arrays when picking the first/last element as pivot? YES ().
- In Open Addressing hashing, does quadratic probing eliminate primary clustering? YES, but it causes secondary clustering.
- Is an AVL tree always a Binary Search Tree? YES (BST property + height-balanced property).
- Can Dijkstra handle negative edge weights? NO (Must use Bellman-Ford).
- How many edges are in a spanning tree of a connected graph with vertices? Exactly edges.
◇References & Navigation
- Previous Topic: ◇CCPROG2, ◇CCDSTRU
- Next Topic: ◇CSALGCM
- Prerequisites: ◇Data Structures, Trees, Graphs, Sorting
- Cross-Curricular Connections: ◇CSINTSY
ACTIVE RECALL VERIFICATION
Select an answer to verify conceptual comprehension and reveal the technical rationale.
What is the time complexity to insert a new element into a binary max heap containing elements?
In an AVL tree, after inserting a node into the left subtree of the right child of node , what rotation sequence is required to restore balance?
Which sorting algorithm is stable and has worst-case time complexity ?
In a hash table with load factor using linear probing, what is the primary drawback of linear probing?
Which graph algorithm will correctly find the Minimum Spanning Tree of a connected weighted graph by sorting all edges in non-decreasing order?